<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let obj = {}
    let objProxy = new Proxy(obj, {
      get(target, prop, receiver) {
        console.log('我触发了', receiver === objProxy);
        
        return target[prop]
      },
      set(target, prop, value, receiver) {
        window[prop] = value
      }
    })
    objProxy.name = 'zzy'
    objProxy.age = 24
    console.log(obj);
    obj.yes = true
    console.log(objProxy);
    
  </script>
</body>
</html>